﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master/Admin.master" AutoEventWireup="true" CodeFile="Auction.aspx.cs" Inherits="SY.WebSite.Web.View.Auction" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <title>列表管理 - 拍卖管理 - 后台管理系统 - <%= Settings.Title %></title>
    <link href="<%= Settings.StaticFileDomain %>/Scripts/util/jquery-pagination/lib/jquery_pagination/pagination.css" rel="stylesheet" type="text/css" />    
    <link href="<%= Settings.StaticFileDomain %>/Scripts/util/JqModal/JqPopU.css" rel="stylesheet" type="text/css" />
    <script src="<%= Settings.StaticFileDomain %>/Scripts/util/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="<%= Settings.StaticFileDomain %>/Scripts/util/template/trimpath-template.js" type="text/javascript"></script>
    <script src="<%= Settings.StaticFileDomain %>/Scripts/util/jquery-pagination/lib/jquery_pagination/jquery.pagination.js" type="text/javascript"></script>
    <script src="<%= Settings.StaticFileDomain %>/Scripts/util/JqModal/JqPopU.js" type="text/javascript"></script>
    <script src="<%= Settings.StaticFileDomain %>/Scripts/util/utility.js" type="text/javascript"></script>
    <script src="<%= Settings.StaticFileDomain %>/Scripts/util/jquery-ajaxupload/jquery.ajaxupload.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" Runat="Server">
    <div>
	    <h1>
		    <small>拍卖管理</small>
	    </h1>
    </div>
    <form class="form-search">
        <fieldset>
            状态：
            <select id="spstatus" style="width:120px">
                <option value="100">全部</option>
                <option value="0">未开始</option>
                <option value="1">进行中</option>
                <option value="2">未扣素币</option>
                <option value="3">已结束</option>
            </select>
            主题：<input class="input" id="title" type="text" placeholder="主题"/>
	        <label class="type right">时间段：</label>
            <input id="start" type="text" class="Wdate date" placeholder="开始时间" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',maxDate:'#F{$dp.$D(\'end\')}'})"/>&nbsp; 
            - &nbsp;<input id="end" type="text" class="Wdate date" placeholder="结束时间" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:'#F{$dp.$D(\'start\')}'})"/>
            <button type="button" class="btn" onclick="page.getList(0)">查询</button>
        </fieldset>
    </form>
    <div id="result"></div>
    <div id="pagination"></div>
    <textarea name="auctionlist" id="auctionlist" style="display:none;"> 
    <table class="table table-hover table-striped">
		<thead>
			<tr>
				<th>状态</th><th>Logo</th><th class="span6">详情</th><th>物品数</th><th>开始时间</th><th>结束时间</th>
                <%--<th>创建时间</th>--%><th>&nbsp;</th>
            </tr>
        </thead>
		<tbody>
            {for p in list}
			<tr>
                <td>@{page.tStatus(p.Status, p.StartTime, p.EndTime)}</td>
                <td><img src="@{p.Image}" alt="@{p.Title}" class="img-rounded" style="width:120px; height:120px;" /></td>
                <td>
                    <blockquote>
                        <p>@{p.Title}</p>
                        <small>创建时间：@{p.CreateTime.ToDate().Format('yyyy-MM-dd hh:mm')}</small>
                        <p style="font-weight:normal; font-size:14px;">@{p.Description.replace(/\n/g,'<br />')}</p>
                    </blockquote>
                </td>
                <td>@{p.Count}</td>
                <td>@{p.StartTime.ToDate().Format('yyyy-MM-dd hh:mm')}</td>
                <td>@{p.EndTime.ToDate().Format('yyyy-MM-dd hh:mm')}</td>
                <%--<td>@{p.CreateBy}<small>()</small></td>
                <td>@{p.CreateTime.ToDate().Format('yyyy-MM-dd hh:mm')}</td>--%>
                <td>
                    <div class="btn-group">
                        <a class="btn" href="#">操作</a>
                        <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            {if p.StartTime.ToDate() > new Date()}
                            <li><a href="javascript:void(0)" onclick="page.edit(@{p.Id})">编辑基本信息</a></li>
                            <li><a href="javascript:void(0)" onclick="page.manageItem(@{p.Id})">查看/管理拍卖物品</a></li>
                            <li><a href="javascript:void(0)" onclick="page.cancel(@{p.Id})">取消</a></li>
                            {elseif p.EndTime.ToDate() <= new Date()}
                            <li><a href="javascript:void(0)" onclick="page.showResult(@{p.Id})">{if p.Status ==1}查看拍卖结果{else}扣除素币{/if}</a></li>
                            {elseif}
                            <li><a href="javascript:void(0)">暂无操作项</a></li>
                            {/if}
                        </ul>
                    </div>
                </td>
			</tr>
            {forelse}
            <tr><td colspan="9">暂无相关数据</td></tr>
            {/for}
		</tbody>
	</table>
    </textarea>

    <textarea name="auctionItemList" id="auctionItemList" style="display:none;"> 
    <table class="table table-striped table-bordered">
        <thead>
            <tr>
                <th>物品名称</th><th class="span5">物品描述</th><th>价格</th><th>最终拍卖者</th><th>拍卖素币</th>
                {if current.Status == 0}
                <th>可用素币</th>
                {/if}
            </tr>
        </thead>
        <tbody>
            {for p in list}
            <tr{if p.Status == 1 || (current.Status == 0 && p.Available < p.BidAmount)} class="error" {/if}>
                <td><img src="@{p.Image}" alt="@{p.Title}" class="img-rounded" style="width:120px; height:120px;" /><br />@{p.Title}</td>
                <td>@{p.Description}</td>
                <td>@{p.Price}</td>
                <td>@{p.BidderName} <small>(@{p.JobNumber})</small></td>
                <td>@{p.BidAmount}</td>
                {if current.Status == 0}
                <td>@{p.Available}</td>
                {/if}
            </tr>
            {/for}
        </tbody>
    </table>
    <p>
        {if current.Status !=1 && current.EndTime.ToDate() <= new Date()}
            <input type="button" value="扣除素币" class="btn btn-primary" onclick="page.charge(@{current.Id})" />
        {/if}
        <span class="text-warning">注：红色标志为拍卖者可用素币不够支付拍卖额度</span>
    </p>
    </textarea>

    <textarea name="detail" id="detail" style="display:none;"> 
    <div class="row">
        <form class="form-horizontal">
            <div class="control-group">
                <label class="control-label" for="utitle">主题</label>
                <div class="controls  controls-row">
                     <input id="utitle" class="span7" placeholder="主题" type="text" required value="@{Title}"/>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="udescription">描述</label>
                <div class="controls">
                    <span id="spnDescription"></span>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="ulogo">Logo</label>
                <div class="controls">
                    <input id="ulogo" placeholder="输入url地址或者上传本地图片" type="text" value="@{Image}" required/>
                    <button class="btn" type="button" id="upload">上传本地图片</button>
                </div>
            </div>
            <div class="control-group" style="float:left">
                <label class="control-label" for="ustart">开始时间</label>
                <div class="controls">
                    <input id="ustart" type="text" value="@{StartTime.ToDate().Format('yyyy-MM-dd hh:mm')}" class="Wdate date" placeholder="开始时间" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',maxDate:'#F{$dp.$D(\'uend\')}'})"/>
                </div>
            </div>
            <div class="control-group" style="float:left">
                <label class="control-label" for="uend">结束时间</label>
                <div class="controls">
                    <input id="uend" type="text" value="@{EndTime.ToDate().Format('yyyy-MM-dd hh:mm')}"  class="Wdate date" placeholder="结束时间" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:'#F{$dp.$D(\'ustart\')}'})"/>
                </div>
            </div>
            <div class="control-group" style="clear:both">
                <label class="control-label"></label>
                <div class="controls">
                    <button type="button" class="btn btn-info" id="btnEdit">保存编辑</button>
                </div>
            </div>
        </form>
    </div>
    </textarea>

    <textarea name="editList" id="editList" style="display:none;"> 
    <div class="rows">
        <div class="span7" id="itemList"></div>
        <div class="span5" style="border-left:solid 1px #DDDDDD">        
            <form class="form-horizontal">
                <div class="control-group">
                    <label class="control-label" for="utitle">物品名称</label>
                    <div class="controls  controls-row">
                         <input id="utitle" placeholder="物品名称" type="text" required/>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="udescription">描述</label>
                    <div class="controls">
                        <span id="spnDescription"></span>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="uprice">价格（元）</label>
                    <div class="controls">
                        <input id="uprice" placeholder="价格（元）" type="text" required/>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="ulogo">图片</label>
                    <div class="controls">
                        <input id="ulogo" placeholder="输入url地址或者上传本地图片" type="text" required/>
                        <button class="btn" type="button" id="upload">上传本地图片</button>
                    </div>
                </div>
                <div class="control-group" style="clear:both">
                    <label class="control-label"></label>
                    <div class="controls">
                        <input type="button" id="btnItemA" value="新增物品" class="btn btn-primary" onclick="page.addItem(@{current.Id})" />
                        <input type="button" id="btnItemB" style="display:none" value="编辑" class="btn btn-primary" />
                        <input type="button" id="btnItemC" style="display:none" value="取消" class="btn btn-primary" onclick="page.cancelEditItem()" />
                    </div>
                </div>
            </form>
        </div>
    </div>
    </textarea>

    <textarea name="itemTemplate" id="itemTemplate" style="display:none;">
        <table class="table table-striped table-bordered">
            <thead>
                <tr>
                    <th>物品名称</th><th>物品描述</th><th>价格</th><th>&nbsp;</th>
                </tr>
            </thead>
            <tbody>
                {for p in list}
                <tr>
                    <td><img src="@{p.Image}" alt="@{p.Title}" class="img-rounded" style="width:120px; height:120px;" /><br />@{p.Title}</td>
                    <td>@{p.Description}</td>
                    <td>@{p.Price}</td>
                    <td>
                        <div class="btn-group">
                            <a class="btn" href="#">操作</a>
                            <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="javascript:void(0)" onclick="page.editItem(@{p.Id}, @{p.AuctionId})">编辑</a></li>
                                <li><a href="javascript:void(0)" onclick="page.deleteItem(@{p.Id}, @{p.AuctionId})">删除</a></li>
                            </ul>
                        </div>
                    </td>
                </tr>
                {forelse}
                <tr><td colspan="4">暂无物品</td></tr>
                {/for}
            </tbody>
        </table>
    </textarea>

    <script src="<%= Settings.StaticFileDomain %>/Scripts/page/admin/auction.js" type="text/javascript"></script>
</asp:Content>